package com.hns.can.master.upgrade;

import com.hns.can.master.service.WebServiceBSService;
import com.hns.frame.processor.TaskProcessor;
import org.springframework.core.task.TaskExecutor;

/**
 * 升级后台处理器
 * @author:zhangzq
 * @email:
 * @version Revision 2.0.0
 */
public class UpgradeProcessor implements TaskProcessor {

    private String canId;
    private String commandStr;
    private TaskExecutor taskExecutor;

    public void process() {
        // 使用多线程处理
        taskExecutor.execute(new Runnable() {
            public void run() {
                WebServiceBSService webServiceBSService = new WebServiceBSService();
                try {
                    webServiceBSService.sendToCommModel(commandStr, canId);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }

    public UpgradeProcessor(String canId, String commandStr, TaskExecutor taskExecutor) {
        this.canId = canId;
        this.commandStr = commandStr;
        this.taskExecutor = taskExecutor;
    }

}
